/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MVC;

import common.*;
import java.io.File;
import java.net.InetAddress;
import java.util.HashMap;

/**
 * ModelMessIn
 * The Model of the MVC pattern 
 * for the different received types of message
 * @author Duy Duc, Metangmo
 */
public class ModelMessIn extends java.util.Observable{
   private Text nouveauMess;
   private File nouveauFile;
   private String notifications;
    
   /**
    * Constructor
    */
    
    public ModelMessIn() {
        
    }
    
    /**
     * addNouveauMessIn:
     * function adds the new received message in the table of message storing
     * and notifies the Observer(ChatGUI) of the change
     * @param mess
     *        New received message
     */
     
    public void addNouveauMessIn(Text mess){
        this.nouveauMess = mess;
        setChanged();
        notifyObservers(nouveauMess);
    }
    
    /**
     * addNouveauMessIn:
     * function adds the new received file in the table of file storing 
     * and notifies the Observer(ChatGUI) of the change
     * @param file
     *        New received file
     */
    
    public void addNouveauFileIn(File file){
        this.nouveauFile = file;
        setChanged();
        notifyObservers(nouveauFile);
    }
    
    /**
     * addNotification:
     * function adds the new notification in the table of notification storing
     * and notifies the Observer(ChatGUI) of the change
     * @param notification 
     */
    
    public void addNotification(String notification){
        this.notifications = notification;
        setChanged();
        notifyObservers(notifications);
    }
    
    /**
     * getNouveauMessIn:
     * function collects the table of new received messages
     * @return 
     *        New received message
     */
    
    public Text getNouveauMessIn() {
        return nouveauMess;
    }
    
    /**
     * getNouveauFileIn:
     * function collects the table of new received files
     * @return 
     *        New received file
     */
    
    public File getNouveauFileIn() {
        return nouveauFile;
    }
    

}
